package com.bilibili.service;

import com.bilibili.dto.CartoonCollectionCountDto;
import com.bilibili.entity.User;

import java.util.List;

public interface PicCollectionService {

    /**
     *
     * @param cartoonId 漫画id
     * @param loginUser 用户
     * @return 检查该用户是否收藏过该漫画
     */
    boolean selectCollectionByIds(User loginUser, Integer cartoonId);

    /**
     * 收藏操作,排行榜相应cartoonId+1,用户收藏中Redis的list也要加上(push)
     * @param loginUser
     * @param cartoonId
     * @return
     */
    boolean addCollection(User loginUser, Integer cartoonId);


    //备用方法
    boolean addPicCollection(User loginUser, Integer cartoonId);

    //备用方法
    boolean delPicCollection(User loginUser, Integer cartoonId);

    /**
     *
     * @return 拿到漫画的排行榜
     */
    List<CartoonCollectionCountDto> getPicCollectionRankList();

    /**
     * 将Redis中收藏数据同步到MySQL中
     */
    void syncRedisCollectionCountToMySql();

    boolean delCollection(User user, Integer cartoonId);
}
